/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	/// 
	/// module : battleLogic
	/// </summary>
	public class BattleAutoPOD : IPOD 
    {
        public readonly static Func<BattleAutoPOD> FACTORY = () => new BattleAutoPOD();
		public static Func<BattleAutoPOD> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        /// 
        /// </summary>
		public bool isOpen;
		/// <summary>
        /// 
        /// </summary>
		public Vector2POD curTempPos;
		/// <summary>
        /// 
        /// </summary>
		public Vector2POD curTempAspect;
		
		
		
		/*-- constructors --*/
		public BattleAutoPOD() {}
		public BattleAutoPOD(bool isOpen, Vector2POD curTempPos, Vector2POD curTempAspect) {
			this.isOpen = isOpen;
			this.curTempPos = curTempPos;
			this.curTempAspect = curTempAspect;
		}
	      public void Serial(SOutputStream _out) {
            _out.Write_boolean(isOpen);
            _out.Write_pod(curTempPos);
            _out.Write_pod(curTempAspect);
        }
        
        public void UnSerial(SInputStream _in) {
            if(!_in.HasRemaining()) return;
            isOpen = _in.Read_boolean();
            if(!_in.HasRemaining()) return;
            curTempPos = _in.Read_pod<Vector2POD>(Vector2POD.DynamicFactory);
            if(!_in.HasRemaining()) return;
            curTempAspect = _in.Read_pod<Vector2POD>(Vector2POD.DynamicFactory);
        }
		
		public BattleAutoPOD Clone() {
            BattleAutoPOD o = DynamicFactory();
            o.isOpen = isOpen;
            if (curTempPos != null) {
                o.curTempPos = curTempPos.Clone();
            }
            if (curTempAspect != null) {
                o.curTempAspect = curTempAspect.Clone();
            }
            return o;
        }
        
        public void Clear() {
            isOpen = default;
            curTempPos = default;
            curTempAspect = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "BattleAutoPOD [";
			str += "isOpen=";
			str += isOpen;
			str += ", curTempPos=";
			str += curTempPos;
			str += ", curTempAspect=";
			str += curTempAspect;
			str += "]";
			return str;
		}
		
	}
}